---
description: "Reference for Nitric's v0 Node.js library - Creates a reference to a secret in the secrets manager."
---

# Node.js - secret()

Creates a reference to a secret in the secrets manager.

```javascript
import { secret } from '@nitric/sdk'

const keyRef = secret('apiKey').for('access')
```

## Parameters

<Properties>
  <Property name="name" required type="string">
    The unique name of this secret within the secrets manager.
  </Property>
</Properties>

## Access

All Nitric resources provide access permissions you can use to specify the level of access your code needs to the resource. See here for details about infrastructure [security](/get-started/foundations/infrastructure/security).

### Available permissions:

---

**put**

This permission allows your code to set a new latest value for a secret.

---

**access**

This permission allows your code to retrieve secret values.

---

## Examples

### Create a reference to a secret

```javascript
import { secret } from '@nitric/sdk'

const keyRef = secret('apiKey').for('put')
```

### See also

- [secret().put()](./secret-put)
- [secret().version()](./secret-version)
- [secret().latest()](./secret-latest)
- [secret().version().access()](./secret-version-access)
